/**
 * 
 */
package com.gxa.ehome.service.impl;


import com.gxa.ehome.dao.UserDao;
import com.gxa.ehome.dao.impl.UserDaoImpl;
import com.gxa.ehome.entity.User;
import com.gxa.ehome.service.UserService;
import com.gxa.ehome.web.servlet.UploadServlet;

import java.util.List;

/**
 * @author bilei
 * @date 2021年3月31日
 */
public class UserServiceImpl implements UserService {

	// UserDao对象解决具体的持久化操作
	UserDao userDao = new UserDaoImpl();


	@Override
	public User selectByPhone(String phone) throws Exception {
		User user = userDao.selectByPhone(phone);
		return user;
	}

	@Override
	public Integer register(User regiuser) throws Exception {
		Integer lines = userDao.insert(regiuser);
		return lines;

	}



	@Override
	public User login(String name) throws Exception {

//		UserBase loUser = userDao.selectByName(name);
///**System.out.println(9998);*/
//		if (loUser != null) {
//			if (MD5Util.encode(pwd).equals(loUser.getPwd())) {
//				return loUser;
//			} else {
//				throw new BusinessException("用户名或密码不正确");
//			}
//		} else {
//			throw new BusinessException("不存在的用户");
////			return null;
//
//		}

return null;
	}

	@Override
	public  List selectAllBypage(Integer page,Integer size) throws Exception {
		return userDao.selectAllBypage(page,size);
	}
//
//	@Override
//	public List<UserBase> selectAlluser() throws Exception {
//		List<UserBase> a1= userDao.selectAll();
//
//		return a1;
//	}
//	@Override
//	public List<UserBase> selectAllByPage(Integer page, Integer size) throws Exception {
//		List<UserBase> userList = userDao.selectByPage(page, size);
//		return userList;
//	}
//
//	@Override
//	public Integer deleteById(Integer id) throws Exception {
//		Integer integer = userDao.deleteById(id);
//		return integer;
//	}
//
//	@Override
//	public void update(Integer id, UserBase user) throws Exception {
//		UserBase selectedUser = userDao.selectById(id);
//		if(selectedUser != null){
//			selectedUser.setName(user.getName());
//			selectedUser.setPwd(MD5Util.encode(user.getPwd()));
//		}
//		userDao.update(id,selectedUser);
//	}

}
